package com.bw.mapper;

import com.bw.bean.Vo;
import com.bw.bean.Vo1;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author:
 * @Date: 2025/3/12 09:05
 * @Description:
 **/
@Mapper
public interface VoMapper {

    @Select("call pro1()")
    Double getList1();

    @Select("select s.name name,format((rating/sum(rating))*100,2)value from shop s\n" +
            "left join order_info oi on s.id = oi.shop_id\n" +
            "where rating=5\n" +
            "group by s.name")
    List<Vo> getList2();

    @Select("select b.name,sum(actual_amount)value from base_province b\n" +
            "left join order_info oi on b.id = oi.province_id\n" +
            "where actual_amount is not null\n" +
            "group by b.name")
    List<Vo> getList3();

    @Select("select o.id,o.status,s.name name1,bp.name name2 from order_info o\n" +
            "left join shop s on s.id = o.shop_id\n" +
            "left join base_province bp on o.province_id = bp.id\n" +
            "group by o.id,o.status,s.name,bp.name\n" +
            "having o.status=2")
    List<Vo1> getList4();

    @Select("select b.id name,count(customer_id)value from base_province b\n" +
            "left join order_info oi on b.id = oi.province_id\n" +
            "where customer_id is not null\n" +
            "group by b.id")
    List<Vo> getList5();

    @Select("select s.name,sum(actual_amount)value from shop s\n" +
            "left join order_info oi on s.id = oi.shop_id\n" +
            "group by s.name\n" +
            "having s.name='Bess Twishes'")
    List<Vo> getList6();
}
